package com.jd.charactercalculator.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import weibo4j.Weibo;
import weibo4j.model.WeiboException;

import com.jd.charactercalculator.controller.common.BaseAjaxController;
import com.jd.charactercalculator.controller.common.BaseController;
import com.jd.charactercalculator.facade.StatusFacade;

/**
 * 
 * @Description: 
 * @author :Sun Lin
 * @date :2012-9-29
 * @since:1.0.0 
 */
public class StatusController extends BaseAjaxController {

	private String viewName;
	private StatusFacade statusFacade;
	
	public ModelAndView updateStatuses(HttpServletRequest request, HttpServletResponse respnose) throws WeiboException{
		Weibo weibo = new Weibo();
		String token = (String)request.getSession().getAttribute("token");
		weibo.setToken(token);
		String status = request.getParameter("status");
		statusFacade.updateStatus(status);
		return new ModelAndView(getViewName());
	}

	public String getViewName() {
		return viewName;
	}

	public void setViewName(String viewName) {
		this.viewName = viewName;
	}

	public StatusFacade getStatusFacade() {
		return statusFacade;
	}

	public void setStatusFacade(StatusFacade statusFacade) {
		this.statusFacade = statusFacade;
	}

}
